home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Resources / Burning & Media / GB-PVR 1.2.13 / GBPVR10213.msi / Cabs.w1.cab / DetailDisplay2.cs465 < prev    next >
Text File  |  2007-11-12  |  6KB  |  128 lines

  1. using System;
  2. using System.Collections;
  3. using GBPVR.Public;
  4.  
  5. namespace gbweb.classes
  6. {
  7.     public class DetailDisplay2
  8.     {
  9.         public static string getDetailDisplay(Programme programme)
  10.         {
  11.             string programUniqueIdentifier = programme.getUniqueProgrammeIdentifier();
  12.             string description = programme.getDescription();
  13.  
  14.             //Check to see if the user uses the ExtendedEWA Extended database
  15.             bool ExtendedEWAEnabled = ExtendedEWA.Initialize();
  16.             if (ExtendedEWAEnabled)
  17.             {
  18.                 //Open the ExtendedEWA DB
  19.                 ExtendedEWA.OpenExtendedEWADB();
  20.             }
  21.  
  22.            //Add a line break if there is a description to provide seperation space
  23.             if (description.Length > 0)
  24.             {
  25.                 description = description + "<br>";
  26.             }
  27.  
  28.             //Retrieve the rating for the show
  29.             string rating = programme.getRating();
  30.             if (rating != null && rating != "")
  31.             {
  32.                 description = description + "<br>" + "  Rated: " + programme.getRating();
  33.             }
  34.  
  35.             //Add the show Genre to the line
  36.             //set the label for the list of genre
  37.             ArrayList genreCheck = programme.getGenreList();
  38.             for (int unknownPos = genreCheck.BinarySearch("unknown", new CaseInsensitiveComparer()); unknownPos > -1;
  39.                 unknownPos = genreCheck.BinarySearch("unknown", new CaseInsensitiveComparer()))
  40.             {
  41.                 genreCheck.RemoveAt(unknownPos);
  42.             }
  43.             for (int unknownPos = genreCheck.BinarySearch(string.Empty, new CaseInsensitiveComparer()); unknownPos > -1;
  44.                 unknownPos = genreCheck.BinarySearch(string.Empty, new CaseInsensitiveComparer()))
  45.             {
  46.                 genreCheck.RemoveAt(unknownPos);
  47.             }
  48.             if (genreCheck.Count > 0)
  49.             {
  50.                 description += "<br>Genre" + (genreCheck.Count > 1 ? "s" : string.Empty) + ": " + string.Join(", ", (string[])genreCheck.ToArray(typeof(string)));
  51.             }
  52.  
  53.             // If the user has ExtendedEWA append additional information to the description when found
  54.             if (ExtendedEWAEnabled)
  55.             {
  56.                 // Pull the Airdate of the Show or the Release Year of the movie and the Start Rating for Movie
  57.                 string[] programInfo = ExtendedEWA.GetProgramInfo(programUniqueIdentifier);
  58.  
  59.                 if (programInfo.Length > 0)
  60.                 {
  61.                     if (programUniqueIdentifier.StartsWith("MV"))
  62.                     {
  63.                         if (programInfo[0] != "0")
  64.                         {
  65.                             description += "<br> Movie Release Year: " + programInfo[0];
  66.                         }
  67.                         if (programInfo[2] != "none")
  68.                         {
  69.                             description += "<br> Star Rating: " + programInfo[2];
  70.                         }
  71.                     }
  72.                     else
  73.                     {
  74.                         if (programInfo[1] != "none")
  75.                         {
  76.                             description += "<br> Original Air Date: " + programInfo[1];
  77.                         }
  78.                     }
  79.                 }
  80.  
  81.                 // Add HD indicator if available and user has selected to show it
  82.                 if (ExtendedEWA.IsHD(programUniqueIdentifier))
  83.                 {
  84.                     description += "<br> <div class=\"HD\" title=\"HD\">HD</div>";
  85.                 }
  86.  
  87.                 // Provide a link to see Cast information
  88.                 description += "<br>" + "(<a href=\"Credits2.aspx?id=" + programme.getOID() +
  89.                                "\" onclick=\"EditPop2(this.href,'Add1');return false;\">Credits</a>)";
  90.  
  91.                 //Check the ExtendedEWA supplemental database to see if the show is a new show
  92.                 if (ExtendedEWA.IsNew(programUniqueIdentifier))
  93.                 {
  94.                     //If show is a new show tag an indicator at the end of the description indicating so
  95.                     description += "<br><div class=\"new_show\" title=\"New episode\">New</div><br>";
  96.                 }
  97.                     //We need to check to see if the airdate is >= to today since the New show identifier is not reliable.
  98.                     //If the airdate is >= programme air date then we can assume it is a new show
  99.                 else if (programInfo.Length > 0)
  100.                 {
  101.                     if (!programUniqueIdentifier.StartsWith("MV"))
  102.                     {
  103.                         if (programInfo[1] != "none")
  104.                         {
  105.                             try
  106.                             {
  107.                                 DateTime airDate = Convert.ToDateTime(programInfo[1]);
  108.                                 if (airDate.Date >= programme.getStartTime().Date)
  109.                                 {
  110.                                     description += "<br><div class=\"new_show\" title=\"New episode\">New</div><br>";
  111.                                 }
  112.                             }
  113.                             catch (Exception e)
  114.                             {
  115.                             }
  116.                         }
  117.                     }
  118.                 }
  119.  
  120.                 //Close the ExtendedEWA DB
  121.                 ExtendedEWA.CloseExtendedEWADB();
  122.             }
  123.  
  124.             return description;
  125.         }
  126.     }
  127. }
  128.